<%--
  Created by IntelliJ IDEA.
  User: 范军建
  Date: 2022/4/15
  Time: 18:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<script src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript">

        function login(){
            alert(1)
            var name = $("#username").val();
            var pass = $("#passwd").val();
            alert(name)
            $.ajax({
                url:"deng",
                type:"get",
                data:{
                    username:name,
                    password:pass
                },
                dataType:"text",
                success:function (data) {
                    console.log(data)
                    if (data=="登录"){
                        alert("成功")
                    }
                },
                error:function () {
                    console.log("dsadsd")
                }
            })
        }

</script>
<!-- 一个简单的表单结构 -->
<form class="login" action="#" method="get">
    <label>用户名：</label>
    <input id="username" type="text" value="">
    <label>密  码：</label>
    <input id="passwd" type="text"  value="">
</form>
<button onclick="login()">登录</button>

</body>
</html>
